#include <iostream>
#include <cstring>
using namespace std;
using ll=long long;
const int N=5*1e3+10;


int t[N],c[N];
ll sumt[N],sumc[N];
ll dp[N];

int n,s;
int main()
{
	cin>>n>>s;
	for(int i=1;i<=n;i++)
	{
		cin>>t[i]>>c[i];
		sumt[i]=sumt[i-1]+t[i];
		sumc[i]=sumc[i-1]+c[i];
		
	}
	memset(dp,0x3f3f3f,sizeof(dp));
	dp[0]=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<i;j++)
		{
			dp[i]=min(dp[i],dp[j]+s*(sumc[n]-sumc[j])+sumt[i]*(sumc[i]-sumc[j]));
		}
	}
	cout<<dp[n]<<endl;
	return 0;
}
